﻿using Microsoft.AspNetCore.Mvc;
using SportsPlatform.Dto.SportBusiness.Employee;
using SportsPlatform.SportBusiness.ISportBusiness;
using SportsPlatform.Base;
using SportsPlatform.Query.SportBusiness.Employee;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SportsPlatform.Filters;
using SportsPlatform.Dto.SportBusiness.Team;
using SportsPlatform.Query.SportBusiness.Team;

namespace SportsPlatform.Controllers
{
    /// <summary>
    /// 用户管理控制器
    /// </summary>

    [ActionAuthorization]
    [Route("api/[controller]/[action]")]
    public class EmployeeController : SportsPlatformControllerBase
    {
        /// <summary>
        /// 用户管理服务接口字段
        /// </summary>
        private IEmployeeService _employeeService;

        /// <summary>
        /// 团队管理服务接口字段
        /// </summary>
        private ITeamService _teamService;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="employeeService"></param>
        /// <param name="teamService"></param>
        public EmployeeController(IEmployeeService employeeService, ITeamService teamService)
        {
            _employeeService = employeeService;
            _teamService = teamService;
        }

        /// <summary>
        /// 获取用户分页数据
        /// </summary>
        /// <param name="pageQuery">查询条件</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagePagingDto<EmployeeDto>> GetEmployeeDtoPage([FromBody] GetEmployeeQuery pageQuery)
        {
            return await _employeeService.GetPagePagingDto(pageQuery);
        }

        /// <summary>
        /// 团队列表查询
        /// </summary>
        /// <param name="Query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagePagingDto<TeamByUserListDto>> GetEmployeeTeamList([FromBody] TeamByUserListQuery Query)
        {
            return await _teamService.GetTeamList(Query);
        }

        /// <summary>
        /// 获取团队内人员信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<GetTeamUserListDto>> GetTeamEmployeeList([FromBody] GetTeamUserListQuery query)
        {
            return await _teamService.GetTeamUserList(query);
        }

    }
}
